using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;

namespace qPrintComponent
{
    [TypeConverter(typeof(ExpandableObjectConverter)), Browsable(true), RefreshProperties(RefreshProperties.None)]
    public sealed class qPrinterStatus
    {
        private PrinterStatus _status;

        public qPrinterStatus(int Status)
        {
            _status = (PrinterStatus)Status;
        }
        public override string ToString()
        {
            return System.Enum.Format(typeof(PrinterStatus), _status, "g");
        }
        public bool Busy
        {
            get { return ((_status & PrinterStatus.Busy) == PrinterStatus.Busy); }
        }
        public bool DoorOpen
        {
            get { return ((_status & PrinterStatus.DoorOpen) == PrinterStatus.DoorOpen); }
        }
        public bool Error
        {
            get { return ((_status & PrinterStatus.Error) == PrinterStatus.Error); }
        }
        public bool Initializing
        {
            get { return ((_status & PrinterStatus.Initializing) == PrinterStatus.Initializing); }
        }
        public bool InputOutputActive
        {
            get { return ((_status & PrinterStatus.IOActive) == PrinterStatus.IOActive); }
        }
        public bool ManualFeed
        {
            get { return ((_status & PrinterStatus.ManualFeed) == PrinterStatus.ManualFeed); }
        }
        public bool NoToner
        {
            get { return ((_status & PrinterStatus.NoToner) == PrinterStatus.NoToner); }
        }
        public bool NotAvailable
        {
            get { return ((_status & PrinterStatus.NotAvailable) == PrinterStatus.NotAvailable); }
        }
        public bool Offline
        {
            get { return ((_status & PrinterStatus.Offline) == PrinterStatus.Offline); }
        }
        public bool OutOfMemory
        {
            get { return ((_status & PrinterStatus.OutOfMemory) == PrinterStatus.OutOfMemory); }
        }
        public bool OutPutBinFull
        {
            get { return ((_status & PrinterStatus.OutputBinFull) == PrinterStatus.OutputBinFull); }
        }
        public bool PagePunt
        {
            get { return ((_status & PrinterStatus.PagePunt) == PrinterStatus.PagePunt); }
        }
        public bool PaperJam
        {
            get { return ((_status & PrinterStatus.PaperJam) == PrinterStatus.PaperJam); }
        }
        public bool PaperOut
        {
            get { return ((_status & PrinterStatus.PaperOut) == PrinterStatus.PaperOut); }
        }
        public bool PaperProblem
        {
            get { return ((_status & PrinterStatus.PaperProblem) == PrinterStatus.PaperProblem); }
        }
        public bool Paused
        {
            get { return ((_status & PrinterStatus.Paused) == PrinterStatus.Paused); }
        }
        public bool PendingDeletion
        {
            get { return ((_status & PrinterStatus.PendingDeletion) == PrinterStatus.PendingDeletion); }
        }
        public bool PowerSave
        {
            get { return ((_status & PrinterStatus.PowerSave) == PrinterStatus.PowerSave); }
        }
        public bool Printing
        {
            get { return ((_status & PrinterStatus.Printing) == PrinterStatus.Printing); }
        }
        public bool Processing
        {
            get { return ((_status & PrinterStatus.Processing) == PrinterStatus.Processing); }
        }
        public bool Ready
        {
            get { return ((_status & PrinterStatus.Ready) == PrinterStatus.Ready); }
        }
        public bool ServerUnknown
        {
            get { return ((_status & PrinterStatus.ServerUnknown) == PrinterStatus.ServerUnknown); }
        }
        public bool TonerLow
        {
            get { return ((_status & PrinterStatus.TonerLow) == PrinterStatus.TonerLow); }
        }
        public bool UserInterventionRequired
        {
            get { return ((_status & PrinterStatus.UserIntervention) == PrinterStatus.UserIntervention); }
        }
        public bool Waiting
        {
            get { return ((_status & PrinterStatus.Waiting) == PrinterStatus.Waiting); }
        }
        public bool WarmingUp
        {
            get { return ((_status & PrinterStatus.WarmingUp) == PrinterStatus.WarmingUp); }
        }


        [FlagsAttribute]
        private enum PrinterStatus : int
        {
            Ready = 0,
            Busy = 0x200,
            DoorOpen = 0x400000,
            Error = 2,
            Initializing = 0x8000,
            IOActive = 0x100,
            ManualFeed = 0x20,
            NotAvailable = 0x1000,
            NoToner = 0x40000,
            Offline = 0x80,
            OutOfMemory = 0x200000,
            OutputBinFull = 0x800,
            PagePunt = 0x80000,
            PaperJam = 8,
            PaperOut = 0x10,
            PaperProblem = 0x40,
            Paused = 1,
            PendingDeletion = 4,
            PowerSave = 0x1000000,
            Printing = 0x400,
            Processing = 0x4000,
            ServerUnknown = 0x800000,
            TonerLow = 0x20000,
            UserIntervention = 0x100000,
            Waiting = 0x2000,
            WarmingUp = 0x10000
        }
    }
}
